package cn.craftyun.yunexam.service.impl;

import cn.craftyun.yunexam.entity.Question;
import cn.craftyun.yunexam.mapper.QuestionMapper;
import cn.craftyun.yunexam.service.QuestionService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService {
    @Resource
    private ObjectMapper objectMapper;

    @Override
    public List<Question> getPaperQuestions(Long paperId) {
        //        获取题目
        Wrapper<Question> wrapper = new QueryWrapper<Question>()
                .eq("paper_id", paperId).orderByAsc("type", "id");

        return getBaseMapper().selectList(wrapper);
    }
}
